package fornecedor;

import org.hibernate.SQLQuery;

import persistencia.GenericDAOAbstract;

public class FornecedorDAOHibernate extends GenericDAOAbstract<Fornecedor, Long>
		implements FornecedorDAO {

	public Fornecedor buscaPorCpfCnpj(String cpfCnpj){
		
		String sql ="SELECT * FROM Fornecedor  f where f.cnpjCpf = '" + cpfCnpj + "'"; 
		SQLQuery sqlQuery = getSession().createSQLQuery(sql).addEntity(Fornecedor.class);
		return (Fornecedor) sqlQuery.uniqueResult(); 
	}
}
